<!DOCTYPE html>
<head>
    <meta charset="UTF-8">
    <title>prueba</title>
</head>
<body>

    <div id='parent'>

    <div id=texto1 style="display: block;">
        holaaa soy main q onda
       <div>
           peo
       </div>
    </div>

    <div id=texto2 style="display: none;">
        sexooooooooooo
        <div>caca</div>
    </div>

    </div>

    <input onclick="change()" type="button">reemplaza</input>


    <script>
        function change() // no ';' here
        {
            var parent = document.getElementById('parent');
            var children = parent.childNodes;
            console.log(children);
            console.log(children[1].id);
            console.log(children[3].id);

            if(children[1].style.display=="block")
            document.getElementById('texto1').style.display = "none";
            if(children[3].style.display=="none")
            document.getElementById('texto2').style.display = "block";
            else if(children[1].style.display=="none")
            document.getElementById('texto1').style.display = "block";
            if(children[3].style.display=="block")
            document.getElementById('texto2').style.display = "none";


        }
    </script>

</body>
</html>